        <!DOCTYPE html>
        <html>
        <head>
                <meta charset="utf-8">
        <title>BodyDef class / box2d_html Library / Dart Documentation</title>
        <link rel="stylesheet" type="text/css"
            href="../styles.css">
        <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800" rel="stylesheet" type="text/css">
        <link rel="shortcut icon" href="../favicon.ico">
        
        </head>
        <body data-library="box2d_html" data-type="BodyDef">
        <div class="page">
        <div class="header">
          <a href="../index.html"><div class="logo"></div></a>
          <a href="../index.html">Dart Documentation</a>
         &rsaquo; <a href="../box2d_html.html">box2d_html</a> &rsaquo; <a href="../box2d_html/BodyDef.html">BodyDef</a>        <div id="search-box">
          <input type="search" name="q" id="q" autocomplete="off"
              class="search-input" placeholder="Search API">
        </div>
        
      </div>
      <div class="drop-down" id="drop-down"></div>
      
        <div class="nav">
        
</div>
<div class="content">
        <h2><strong>BodyDef</strong>
          class
        </h2>
        
<button id="show-inherited" class="show-inherited">Hide inherited</button>
<div class="doc">
<p>Defines a rigid body. Manipulate the properties of the definition in order
to create bodies with those properties. BodyDefinitions can be reused.</p>
<pre class="source">
class BodyDef {
  /**
   * The body type: static, kinematic, or dynamic.
   * Note: if a dynamic body would have zero mass, the mass is set to one.
   */
  int type;

  /**
   * The world angle of the body in radians.
   */
  num angle;

  /** User can store whatever they wish in here. */
  Object userData;

  /** The world position of the body. */
  Vector position;

  /** Linear velocity of the body in world coordinates. */
  Vector linearVelocity;

  /** Angular velocity of the body. */
  num angularVelocity;

  /**
   * If true, the body will be allowed to rotate. Otherwise, its rotation will
   * be fixed.
   */
  bool fixedRotation;

  /** If true, this body is initially sleeping. */
  bool isSleeping;

  /**
   * Is this a fast moving body that should be prevented from tunneling
   * through other moving bodies? Note that all bodies are prevented from
   * tunneling through kinematic and static bodies. This setting is only
   * considered on dynamic bodies.
   *
   * You should use this flag sparingly since it increases processing time.
   */
  bool bullet;

  /** Set to false to prevent a body from ever falling asleep. */
  bool allowSleep;

  /**
   * Linear damping is used to reduce the linear velocity. The damping
   * parameter can be larger than 1.0 but the damping effect becomes
   * sensitive to the time step when the damping parameter is large.
   */
  num linearDamping;

  /**
   * Angular damping is used to reduce the angular velocity. The
   * damping parameter can be larger than 1.0 but the damping effect
   * becomes sensitive to time step when the damping parameter is large.
   */
  num angularDamping;

  /** Is this body initially awake or asleep? */
  bool awake;

  /** If true, this body starts out active. */
  bool active;

  /**
   * Constructs a new BodyDef with default values.
   */
  BodyDef() :
    userData = null,
    bullet = false,
    type = BodyType.STATIC,
    position = new Vector(),
    angle = 0,
    linearDamping = 0,
    angularDamping = 0,
    allowSleep = true,
    awake = true,
    fixedRotation = false,
    active = true,
    linearVelocity = new Vector(),
    angularVelocity = 0;
}
</pre>
</div>
<div>
<h3>Constructors</h3>
<div class="method"><h4 id="BodyDef">
<button class="show-code">Code</button>
new <strong>BodyDef</strong>() <a class="anchor-link" href="#BodyDef"
              title="Permalink to BodyDef.BodyDef">#</a></h4>
<div class="doc">
<p>Constructs a new BodyDef with default values.</p>
<pre class="source">
BodyDef() :
  userData = null,
  bullet = false,
  type = BodyType.STATIC,
  position = new Vector(),
  angle = 0,
  linearDamping = 0,
  angularDamping = 0,
  allowSleep = true,
  awake = true,
  fixedRotation = false,
  active = true,
  linearVelocity = new Vector(),
  angularVelocity = 0;
</pre>
</div>
</div>
</div>
<div>
<h3>Properties</h3>
<div class="field"><h4 id="active">
<button class="show-code">Code</button>
bool         <strong>active</strong> <a class="anchor-link"
            href="#active"
            title="Permalink to BodyDef.active">#</a>
        </h4>
        <div class="doc">
<p>If true, this body starts out active.</p>
<pre class="source">
bool active;
</pre>
</div>
</div>
<div class="field"><h4 id="allowSleep">
<button class="show-code">Code</button>
bool         <strong>allowSleep</strong> <a class="anchor-link"
            href="#allowSleep"
            title="Permalink to BodyDef.allowSleep">#</a>
        </h4>
        <div class="doc">
<p>Set to false to prevent a body from ever falling asleep.</p>
<pre class="source">
bool allowSleep;
</pre>
</div>
</div>
<div class="field"><h4 id="angle">
<button class="show-code">Code</button>
num         <strong>angle</strong> <a class="anchor-link"
            href="#angle"
            title="Permalink to BodyDef.angle">#</a>
        </h4>
        <div class="doc">
<p>The world angle of the body in radians.</p>
<pre class="source">
num angle;
</pre>
</div>
</div>
<div class="field"><h4 id="angularDamping">
<button class="show-code">Code</button>
num         <strong>angularDamping</strong> <a class="anchor-link"
            href="#angularDamping"
            title="Permalink to BodyDef.angularDamping">#</a>
        </h4>
        <div class="doc">
<p>Angular damping is used to reduce the angular velocity. The
damping parameter can be larger than 1.0 but the damping effect
becomes sensitive to time step when the damping parameter is large.</p>
<pre class="source">
num angularDamping;
</pre>
</div>
</div>
<div class="field"><h4 id="angularVelocity">
<button class="show-code">Code</button>
num         <strong>angularVelocity</strong> <a class="anchor-link"
            href="#angularVelocity"
            title="Permalink to BodyDef.angularVelocity">#</a>
        </h4>
        <div class="doc">
<p>Angular velocity of the body.</p>
<pre class="source">
num angularVelocity;
</pre>
</div>
</div>
<div class="field"><h4 id="awake">
<button class="show-code">Code</button>
bool         <strong>awake</strong> <a class="anchor-link"
            href="#awake"
            title="Permalink to BodyDef.awake">#</a>
        </h4>
        <div class="doc">
<p>Is this body initially awake or asleep?</p>
<pre class="source">
bool awake;
</pre>
</div>
</div>
<div class="field"><h4 id="bullet">
<button class="show-code">Code</button>
bool         <strong>bullet</strong> <a class="anchor-link"
            href="#bullet"
            title="Permalink to BodyDef.bullet">#</a>
        </h4>
        <div class="doc">
<p>Is this a fast moving body that should be prevented from tunneling
through other moving bodies? Note that all bodies are prevented from
tunneling through kinematic and static bodies. This setting is only
considered on dynamic bodies.</p>
<p>You should use this flag sparingly since it increases processing time.</p>
<pre class="source">
bool bullet;
</pre>
</div>
</div>
<div class="field"><h4 id="fixedRotation">
<button class="show-code">Code</button>
bool         <strong>fixedRotation</strong> <a class="anchor-link"
            href="#fixedRotation"
            title="Permalink to BodyDef.fixedRotation">#</a>
        </h4>
        <div class="doc">
<p>If true, the body will be allowed to rotate. Otherwise, its rotation will
be fixed.</p>
<pre class="source">
bool fixedRotation;
</pre>
</div>
</div>
<div class="field"><h4 id="isSleeping">
<button class="show-code">Code</button>
bool         <strong>isSleeping</strong> <a class="anchor-link"
            href="#isSleeping"
            title="Permalink to BodyDef.isSleeping">#</a>
        </h4>
        <div class="doc">
<p>If true, this body is initially sleeping.</p>
<pre class="source">
bool isSleeping;
</pre>
</div>
</div>
<div class="field"><h4 id="linearDamping">
<button class="show-code">Code</button>
num         <strong>linearDamping</strong> <a class="anchor-link"
            href="#linearDamping"
            title="Permalink to BodyDef.linearDamping">#</a>
        </h4>
        <div class="doc">
<p>Linear damping is used to reduce the linear velocity. The damping
parameter can be larger than 1.0 but the damping effect becomes
sensitive to the time step when the damping parameter is large.</p>
<pre class="source">
num linearDamping;
</pre>
</div>
</div>
<div class="field"><h4 id="linearVelocity">
<button class="show-code">Code</button>
<a href="../box2d_html/Vector.html">Vector</a>         <strong>linearVelocity</strong> <a class="anchor-link"
            href="#linearVelocity"
            title="Permalink to BodyDef.linearVelocity">#</a>
        </h4>
        <div class="doc">
<p>Linear velocity of the body in world coordinates.</p>
<pre class="source">
Vector linearVelocity;
</pre>
</div>
</div>
<div class="field"><h4 id="position">
<button class="show-code">Code</button>
<a href="../box2d_html/Vector.html">Vector</a>         <strong>position</strong> <a class="anchor-link"
            href="#position"
            title="Permalink to BodyDef.position">#</a>
        </h4>
        <div class="doc">
<p>The world position of the body.</p>
<pre class="source">
Vector position;
</pre>
</div>
</div>
<div class="field inherited"><h4 id="runtimeType">
<button class="show-code">Code</button>
final Type         <strong>runtimeType</strong> <a class="anchor-link"
            href="#runtimeType"
            title="Permalink to BodyDef.runtimeType">#</a>
        </h4>
        <div class="inherited-from">inherited from Object </div><div class="doc">
<p>A representation of the runtime type of the object.</p>
<pre class="source">
external Type get runtimeType;
</pre>
</div>
</div>
<div class="field"><h4 id="type">
<button class="show-code">Code</button>
int         <strong>type</strong> <a class="anchor-link"
            href="#type"
            title="Permalink to BodyDef.type">#</a>
        </h4>
        <div class="doc">
<p>The body type: static, kinematic, or dynamic.
Note: if a dynamic body would have zero mass, the mass is set to one.</p>
<pre class="source">
int type;
</pre>
</div>
</div>
<div class="field"><h4 id="userData">
<button class="show-code">Code</button>
Object         <strong>userData</strong> <a class="anchor-link"
            href="#userData"
            title="Permalink to BodyDef.userData">#</a>
        </h4>
        <div class="doc">
<p>User can store whatever they wish in here.</p>
<pre class="source">
Object userData;
</pre>
</div>
</div>
</div>
<div>
<h3>Operators</h3>
<div class="method inherited"><h4 id="==">
<button class="show-code">Code</button>
bool <strong>operator ==</strong>(other) <a class="anchor-link" href="#=="
              title="Permalink to BodyDef.operator ==">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>The equality operator.</p>
<p>The default behavior for all <code>Object</code>s is to return true if and
only if <code>this</code> and 
<span class="param">other</span> are the same object.</p>
<p>If a subclass overrides the equality operator it should override
the <code>hashCode</code> method as well to maintain consistency.</p>
<pre class="source">
bool operator ==(other) =&gt; identical(this, other);
</pre>
</div>
</div>
</div>
<div>
<h3>Methods</h3>
<div class="method"><h4 id="BodyDef">
<button class="show-code">Code</button>
new <strong>BodyDef</strong>() <a class="anchor-link" href="#BodyDef"
              title="Permalink to BodyDef.BodyDef">#</a></h4>
<div class="doc">
<p>Constructs a new BodyDef with default values.</p>
<pre class="source">
BodyDef() :
  userData = null,
  bullet = false,
  type = BodyType.STATIC,
  position = new Vector(),
  angle = 0,
  linearDamping = 0,
  angularDamping = 0,
  allowSleep = true,
  awake = true,
  fixedRotation = false,
  active = true,
  linearVelocity = new Vector(),
  angularVelocity = 0;
</pre>
</div>
</div>
<div class="method inherited"><h4 id="hashCode">
<button class="show-code">Code</button>
int <strong>hashCode</strong>() <a class="anchor-link" href="#hashCode"
              title="Permalink to BodyDef.hashCode">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>Get a hash code for this object.</p>
<p>All objects have hash codes. Hash codes are guaranteed to be the
same for objects that are equal when compared using the equality
operator <code>==</code>. Other than that there are no guarantees about
the hash codes. They will not be consistent between runs and
there are no distribution guarantees.</p>
<p>If a subclass overrides <code>hashCode</code> it should override the
equality operator as well to maintain consistency.</p>
<pre class="source">
external int hashCode();
</pre>
</div>
</div>
<div class="method inherited"><h4 id="noSuchMethod">
<button class="show-code">Code</button>
<strong>noSuchMethod</strong>(String name, List args) <a class="anchor-link" href="#noSuchMethod"
              title="Permalink to BodyDef.noSuchMethod">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p><code>noSuchMethod</code> is invoked when users invoke a non-existant method
on an object. The name of the method and the arguments of the
invocation are passed to <code>noSuchMethod</code>. If <code>noSuchMethod</code>
returns a value, that value becomes the result of the original
invocation.</p>
<p>The default behavior of <code>noSuchMethod</code> is to throw a
<code>noSuchMethodError</code>.</p>
<pre class="source">
external Dynamic noSuchMethod(String name, List args);
</pre>
</div>
</div>
<div class="method inherited"><h4 id="Object">
<button class="show-code">Code</button>
const <strong>Object</strong>() <a class="anchor-link" href="#Object"
              title="Permalink to BodyDef.Object">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>Creates a new <code>Object</code> instance.</p>
<p><code>Object</code> instances have no meaningful state, and are only useful
through their identity. An <code>Object</code> instance is equal to itself
only.</p>
<pre class="source">
const Object();
</pre>
</div>
</div>
<div class="method inherited"><h4 id="toString">
<button class="show-code">Code</button>
String <strong>toString</strong>() <a class="anchor-link" href="#toString"
              title="Permalink to BodyDef.toString">#</a></h4>
<div class="inherited-from">inherited from Object </div><div class="doc">
<p>Returns a string representation of this object.</p>
<pre class="source">
external String toString();
</pre>
</div>
</div>
</div>
        </div>
        <div class="clear"></div>
        </div>
        
        <div class="footer">
          
        </div>
        <script async src="../client-live-nav.js"></script>
        </body></html>
        
